package com.learn.springbootlogback;

import jakarta.annotation.PostConstruct;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class SpringbootLogbackApplication {

    private static final Logger logger = LoggerFactory.getLogger(SpringbootLogbackApplication.class);

    public static void main(String[] args) {
        SpringApplication.run(SpringbootLogbackApplication.class, args);
    }


    /**
     * @PostConstruct 注解，在类初始化时执行，相当于构造函数，但比构造函数先执行
     */
    @PostConstruct
    public void test() {
        logger.trace("Trace Message");
        logger.debug("Debug Message");
        logger.info("Info Message");
        logger.warn("Warn Message");
        logger.error("Error Message");

        logger.trace("Trace 级别日志");
        logger.debug("Debug 级别日志");
        logger.info("Info 级别日志");
        logger.warn("Warn 级别日志");
        logger.error("Error 级别日志");

        int a = 10/0;
    }


}
